package org.korifey.ffbdd.api.traverse;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import org.korifey.ffbdd.api.INode;
import org.korifey.ffbdd.api.INonterminal;
import org.korifey.ffbdd.api.ITraverseStrategy;

public class DependantVarsStrategy implements ITraverseStrategy {
	
	Set<Integer> acc = new HashSet<Integer>();
	
	public List<Integer> getAccumulated() {
		List<Integer> res = new ArrayList<Integer>();
		res.addAll(acc);
		return res;
	}
	
	@Override
	public void proccess(INode node) {
		if (!node.isTerm()) {
			acc.add(((INonterminal)node).var());
		}
	}

}
